using System;
using Newtonsoft.Json;

namespace CoreLibrary.Email.Impl.Mandrill {

    public class MailAttachment {
		
		[JsonProperty(PropertyName = "type")]    public string type    { get; set; }
        [JsonProperty(PropertyName = "name")]    public string name    { get; set; }
        [JsonProperty(PropertyName = "content")] public string content { get; set; }

        public static MailAttachment Create(string name, byte[] bytes) {
            return new MailAttachment {
                   name    = Util.GetString(name),
                   type    = MimeType.GetType(name, MimeType.GetType(string.Empty)),
                   content = Convert.ToBase64String(bytes),
            };
        }

    }

}